using System;

namespace Demo
{
    internal static class DatabaseConfig
    {
        private const string DefaultConnectionString =
            "Server=localhost;Database=CognitiveTestDB;Trusted_Connection=True;TrustServerCertificate=True;";

        internal static string ConnectionString { get; } = ResolveConnectionString();

        private static string ResolveConnectionString()
        {
            var fromEnvironment = Environment.GetEnvironmentVariable("COGNITIVE_TEST_CONN");
            return string.IsNullOrWhiteSpace(fromEnvironment)
                ? DefaultConnectionString
                : fromEnvironment;
        }
    }
}

